/* GUI CONVERTED from rerepm.p (converter v1.76) Tue Oct  2 12:13:57 2001 */
/* rerepm.p - REPETITIVE CONTROL FILE MAINTENANCE                             */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.8.1.8 $                                                       */
/* REVISION: 7.3      LAST MODIFIED: 10/31/94   BY: WUG *GN77*                */
/* REVISION: 7.3      LAST MODIFIED: 11/08/94   BY: WUG *GO39*                */
/* REVISION: 7.3      LAST MODIFIED: 03/06/95   BY: WUG *G0GJ*                */
/* REVISION: 7.3      LAST MODIFIED: 03/29/95   BY: dzn *F0PN*                */
/* REVISION: 7.3      LAST MODIFIED: 05/02/95   BY: WUG *G0LV*                */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 07/30/98   BY: *J2TH* Sandesh Mahagaokar */
/* REVISION: 8.6E     LAST MODIFIED: 08/17/98   BY: *H1J5* Dana Tunstall      */
/* REVISION: 8.6E     LAST MODIFIED: 03/22/99   BY: *L0DN* Prashanth Narayan  */
/* REVISION: 9.1      LAST MODIFIED: 10/01/99   BY: *N014* Jeff Wootton       */
/* REVISION: 9.1      LAST MODIFIED: 01/19/00   BY: *N077* Vijaya Pakala      */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 07/24/00   BY: *N0GD* Peggy Ng           */
/* REVISION: 9.1      LAST MODIFIED: 09/11/00   BY: *N0RS* Mudit Mehta        */
/* Revision: 1.8.1.7  BY: Hualin Zhong          DATE: 06/13/01 ECO: *N0ZF*    */
/* $Revision: 1.8.1.8 $  BY: Robin McCarthy        DATE: 10/01/01 ECO: *P025*    */

/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/*REPETITIVE CONTROL FILE MAINT                                              */

/*V8:ConvertMode=Maintenance                                                  */

{mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rerepm_p_1 "Include Yield"
/* MaxLen: Comment: */

&SCOPED-DEFINE rerepm_p_2 "End Eff Days"
/* MaxLen: Comment: */

&SCOPED-DEFINE rerepm_p_3 "Enable New Repetitive"
/* MaxLen: Comment: */

&SCOPED-DEFINE rerepm_p_4 "End Eff Default Method"
/* MaxLen: Comment: */

&SCOPED-DEFINE rerepm_p_6 "Transfer WIP"
/* MaxLen: Comment: */

/* DEFINED PRE-PROCESSOR FOR "Zero Balance WIP" */
&SCOPED-DEFINE rerepm_p_9 "Zero Balance WIP"
/* MaxLen:21 Comment: Zero balance work-in-process */

/* ********** End Translatable Strings Definitions ********* */

define variable rpc_xfer_wip like mfc_logical label {&rerepm_p_6}.
define variable rpc_eff_dflt as character format "x(1)"
   label {&rerepm_p_4}.
define variable rpc_eff_days as integer   format ">>9"
   label {&rerepm_p_2}.
define variable rpc_inc_yld   like mfc_logical label {&rerepm_p_1}.
define variable rpc_using_new like mfc_logical label {&rerepm_p_3}.
define variable valmsg as character.
define variable valid_acct as logical.
define variable rpc_zero_bal_wip like mfc_logical
   label {&rerepm_p_9} no-undo.
define variable ten as character format "x(10)" no-undo.

ten = getTermLabel("TEN",6) + "(10)".
/* Not a valid value */
{pxmsg.i &MSGNUM=4291 &ERRORLEVEL=3 &MSGBUFFER=valmsg}

/* Replaced all occurrences of {reval.i} with validate message */


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
rpc_nbr           colon 30 validate(rpc_nbr <> ?,valmsg)
   rpc_nbr_pre       colon 30 validate(rpc_nbr_pre <> ?,valmsg)
   skip (1)
   rpc_using_new     colon 30 validate(rpc_using_new <> ?,valmsg)
   rpc_xfer_wip      colon 30 validate(rpc_xfer_wip <> ?,valmsg)
   rpc_wxfer_acct    colon 30 validate(rpc_wxfer_acct <> ?,valmsg)
   rpc_wxfer_sub     no-label validate(rpc_wxfer_sub <> ?,valmsg)
   rpc_wxfer_cc      no-label validate(rpc_wxfer_cc <> ?,valmsg)
   rpc_eff_dflt      colon 30 validate(rpc_eff_dflt <> ?,valmsg)
   rpc_eff_days      colon 30 validate(rpc_eff_days <> ?,valmsg)
   skip(1)
   rpc_inc_yld       colon 30 validate(rpc_inc_yld <> ?,valmsg)
   skip(1)
   rpc_zero_bal_wip  colon 30 validate(rpc_zero_bal_wip <> ?,valmsg)
 SKIP(.4)  /*GUI*/
with frame a side-labels attr-space width 80 NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

{gprun.i ""rerepma.p""}
/*GUI*/ if global-beam-me-up then undo, leave.


repeat with frame a:
/*GUI*/ if global-beam-me-up then undo, leave.


   find first rpc_ctrl exclusive-lock.

   find mfc_ctrl where mfc_field = "rpc_using_new" exclusive-lock.
   rpc_using_new = mfc_logical.

   find mfc_ctrl where mfc_field = "rpc_xfer_wip" exclusive-lock.
   rpc_xfer_wip = mfc_logical.

   find mfc_ctrl where mfc_field = "rpc_eff_dflt" exclusive-lock.
   rpc_eff_dflt = mfc_char.

   find mfc_ctrl where mfc_field = "rpc_eff_days" exclusive-lock.
   rpc_eff_days = mfc_integer.

   find mfc_ctrl where mfc_field = "rpc_inc_yld" exclusive-lock.
   rpc_inc_yld = mfc_logical.

   find mfc_ctrl where mfc_field = "rpc_zero_bal_wip" exclusive-lock.
   if available mfc_ctrl then
      rpc_zero_bal_wip = mfc_logical.

   display
      rpc_nbr
      rpc_nbr_pre
      rpc_using_new
      rpc_xfer_wip
      rpc_wxfer_acct
      rpc_wxfer_sub
      rpc_wxfer_cc
      rpc_eff_dflt
      rpc_eff_dflt
      rpc_eff_days
      rpc_inc_yld
      rpc_zero_bal_wip.

   do on error undo, retry:
/*GUI*/ if global-beam-me-up then undo, leave.

      set
         rpc_nbr
         rpc_nbr_pre
         rpc_using_new
         rpc_xfer_wip
         rpc_wxfer_acct
         rpc_wxfer_sub
         rpc_wxfer_cc
         rpc_eff_dflt
         rpc_eff_dflt
         rpc_eff_days
         rpc_inc_yld
         rpc_zero_bal_wip.

      if length(rpc_nbr_pre + string(rpc_nbr)) > 10 then do:
         /* Prefix and number combined cannot exceed # characters */
         {pxmsg.i &MSGNUM=312 &ERRORLEVEL=3 &MSGARG1=ten}
         undo, retry.
      end.

      if rpc_using_new then do:

         find first wo_mstr
         where wo_type = "c"
           and wo_nbr > ""
           and wo_status <> "c"
         no-lock no-error.

         if available wo_mstr then do:
            /* You must run rewocl.p before using this module */
            {pxmsg.i &MSGNUM=5121 &ERRORLEVEL=3}
            undo, retry.
         end.

      end.

      else do:

         find first wo_mstr where wo_type = "c" and wo_nbr = ""
         no-lock no-error.

         if available wo_mstr then do:
            /* You must delete all cum orders using recwomt.p before switching */
            {pxmsg.i &MSGNUM=5125 &ERRORLEVEL=3}
            undo, retry.
         end.

      end.

      if rpc_wxfer_acct > ""
         or rpc_wxfer_sub > ""
         or rpc_wxfer_cc > "" then do:

         {gprunp.i "gpglvpl" "p" "initialize"}

         /* SET PROJECT VERIFICATION TO NO */
         {gprunp.i "gpglvpl" "p" "set_proj_ver" "(input false)"}
         {gprunp.i "gpglvpl" "p" "validate_fullcode" "(input  rpc_wxfer_acct,
                                                       input  rpc_wxfer_sub,
                                                       input  rpc_wxfer_cc,
                                                       input  """",
                                                       output valid_acct)"}
         if not valid_acct then do:
            next-prompt rpc_wxfer_acct with frame a.
            undo, retry.
         end.
      end.

   end.
/*GUI*/ if global-beam-me-up then undo, leave.


   find mfc_ctrl where mfc_field = "rpc_using_new" exclusive-lock.
   mfc_logical = rpc_using_new.

   find mfc_ctrl where mfc_field = "rpc_xfer_wip" exclusive-lock.
   mfc_logical = rpc_xfer_wip.

   find mfc_ctrl where mfc_field = "rpc_eff_dflt" exclusive-lock.
   mfc_char = rpc_eff_dflt.

   find mfc_ctrl where mfc_field = "rpc_eff_days" exclusive-lock.
   mfc_integer = rpc_eff_days.

   find mfc_ctrl where mfc_field = "rpc_inc_yld" exclusive-lock.
   mfc_logical = rpc_inc_yld.

   find mfc_ctrl where mfc_field = "rpc_zero_bal_wip" exclusive-lock.
   if available mfc_ctrl then
      mfc_logical = rpc_zero_bal_wip.

end.
/*GUI*/ if global-beam-me-up then undo, leave.

